﻿<UserControl x:Class="SpringGraphExample.Views.TemplateSelectorGraph"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:graph="clr-namespace:SpringGraph;assembly=SpringGraph"
    xmlns:graphControls="clr-namespace:SpringGraph.Controls;assembly=SpringGraph"
    xmlns:templateSelectors="clr-namespace:SpringGraphExample.TemplateSelectors"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
    
    <UserControl.Resources>
        <ControlTemplate x:Key="ProductTemplate" >
            <Grid>
            </Grid>
        </ControlTemplate>

        <ControlTemplate x:Key="CategoryTemplate" >
            <Grid>
            </Grid>
        </ControlTemplate>

        <templateSelectors:CustomTemplateSelector x:Key="CustomTemplateSelector"
                                               ProductTemplate="{StaticResource ProductTemplate}"
                                               CategoryTemplate="{StaticResource CategoryTemplate}" />

        <Line x:Key="graphEdge" Stroke="Gray" Fill="Gray" StrokeThickness="1" />
    </UserControl.Resources>
    
    
    <Grid x:Name="LayoutRoot" Background="White">

        <graph:SpringGraph x:Name="Graph" RepulsionFactor="0.4"
                           HorizontalAlignment="Stretch" VerticalAlignment="Stretch" 
                           DefaultLine="{StaticResource graphEdge}" 
                           NodeTemplateSelector="{StaticResource nodeTemplateSelector}" >

            <graphControls:NavControl Expanded="False" InvertedMovement="False" ExpandOnLoad="True" ExpandOnLoadDelay="1"
                  HorizontalAlignment="Left" VerticalAlignment="Top" 
                  Margin="10,10,0,0" RenderTransformOrigin="0.5,0.5" >
                <graphControls:NavControl.RenderTransform>
                    <TransformGroup>
                        <ScaleTransform ScaleX="0.8" ScaleY="0.8"/>
                        <SkewTransform/>
                        <RotateTransform/>
                        <TranslateTransform/>
                    </TransformGroup>
                </graphControls:NavControl.RenderTransform>
            </graphControls:NavControl>

        </graph:SpringGraph>

    </Grid>
</UserControl>
